﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace FwProject.Migrations.FwProjectAppShopDb
{
    public partial class Edit_To_database_appshop : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_settlement_supplier_shop_order_OrderId",
                table: "settlement_supplier");

            migrationBuilder.DropIndex(
                name: "IX_settlement_supplier_OrderId",
                table: "settlement_supplier");

            migrationBuilder.RenameColumn(
                name: "OrderId",
                table: "settlement_supplier",
                newName: "OrderDetailsId");

            migrationBuilder.AddColumn<bool>(
                name: "isActive",
                table: "commodity_collection",
                nullable: false,
                defaultValue: false);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "isActive",
                table: "commodity_collection");

            migrationBuilder.RenameColumn(
                name: "OrderDetailsId",
                table: "settlement_supplier",
                newName: "OrderId");

            migrationBuilder.CreateIndex(
                name: "IX_settlement_supplier_OrderId",
                table: "settlement_supplier",
                column: "OrderId");

            migrationBuilder.AddForeignKey(
                name: "FK_settlement_supplier_shop_order_OrderId",
                table: "settlement_supplier",
                column: "OrderId",
                principalTable: "shop_order",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
